#! /usr/bin/env python
# -*- coding: utf8 -*-

# #portugues@ScoutLink 2006 JOTI Bot (slbot)
# Copyright (c) 2006, ScoutLink #portugues team
# This source is released under the New BSD License. See the LICENSE file for further
# information.

# $Author$
# $Date$ 

__version__ = "$Revision$"
# $Source$

from twisted.tap.telnet import makeService

from twisted.plugin import IPlugin
from slbot.slinterface import ISLPlugin
from zope.interface import implements

class SLTelnetConsole:
	implements(IPlugin, ISLPlugin)

	author_name    = 'Alexandre Coster'
	author_email   = 'acoster@ScoutLink.net'
	author_webpage = 'http://acoster.net/'
	plugin_name    = 'Remote python shell'
	plugin_version = '0.1'

	def register_me(self, b):
		conf = {}

		try:
			conf['username'] = b.cfg.get('telnet', 'username')
			conf['password'] = b.cfg.get('telnet', 'password')
			conf['port']     = b.cfg.get('telnet', 'port')
		except:
			return

		a = makeService(conf)
		a.bot = b
		a.startService()

plugin = SLTelnetConsole()
